package MyDynamicProxyTest;

import MyStaticProxy.UserDao;
import MyStaticProxy.UserDaoImpl;

public class MyDynamicProxyTest {

    public static void main(String[] args) {
        User user = new UserImpl();

        user.think();

        ProxyFactory proxyFactory = new ProxyFactory();
        User user1 = (User) proxyFactory.CreateProxy(user);
        user1.think();

        System.out.println("---------------------------");

        UserDao userDao = new UserDaoImpl();
        ProxyFactory proxyFactory1 = new ProxyFactory();

        UserDao user2 = (UserDao)proxyFactory1.CreateProxy(userDao);
        user2.say();
        user2.work();
    }


}
